home *** CD-ROM | disk | FTP | other *** search
/ Delphi Informant Complete 1995 - 2000 / Delphi Informant Complete 1995 to 2000.iso / Delphi Informant Magazine Complete Works SOURCE CODE 1995.rar / 1995 / JUL / CJ9507 / orders.pas < prev    next >
Pascal/Delphi Source File  |  1995-06-15  |  2KB  |  69 lines

  1. unit Orders;
  2.  
  3. interface
  4.  
  5. uses
  6.   SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  7.   Forms, Dialogs, StdCtrls, DBTables, DB, Mask, DBCtrls, ExtCtrls, Grids,
  8.   DBGrids;
  9.  
  10. type
  11.   TForm1 = class(TForm)
  12.     DataSource1: TDataSource;
  13.     DataSource2: TDataSource;
  14.     DataSource3: TDataSource;
  15.     Table1: TTable;
  16.     Table2: TTable;
  17.     Table3: TTable;
  18.     DBGrid1: TDBGrid;
  19.     DBNavigator1: TDBNavigator;
  20.     DBEdit1: TDBEdit;
  21.     Label1: TLabel;
  22.     Table2ItemNo: TFloatField;
  23.     Table2PartNo: TFloatField;
  24.     Table2Qty: TIntegerField;
  25.     Table2Discount: TFloatField;
  26.     Table2OrderNo: TFloatField;
  27.     Table2Price: TCurrencyField;
  28.     Table2Amount: TCurrencyField;
  29.     Table3PartNo: TFloatField;
  30.     Table3ListPrice: TCurrencyField;
  31.     Table2Description: TStringField;
  32.     Table3Description: TStringField;
  33.     Label2: TLabel;
  34.     procedure Button1Click(Sender: TObject);
  35.     procedure Table2CalcFields(DataSet: TDataset);
  36.   private
  37.     { Private declarations }
  38.   public
  39.     { Public declarations }
  40.   end;
  41.  
  42. var
  43.   Form1: TForm1;
  44.  
  45. implementation
  46.  
  47. {$R *.DFM}
  48.  
  49. procedure TForm1.Button1Click(Sender: TObject);
  50. begin
  51. close
  52. end;
  53.  
  54. procedure TForm1.Table2CalcFields(DataSet: TDataset);
  55. var
  56.    SubTotal :  real;
  57. begin;
  58. if Table3.FindKey([Table2PartNo.value]) then
  59. begin;
  60.   Table2Price.value := Table3ListPrice.value;
  61.   Table2Description.value := Table3Description.value;
  62.   Subtotal := Table2Price.AsFloat * Table2Qty.AsFloat;
  63.   Table2Amount.value := SubTotal -
  64.                        (SubTotal * (Table2Discount.AsFloat / 100));
  65. end;
  66. end;
  67.  
  68. end.
  69.